﻿
Partial Class Apps_redirect
    Inherits System.Web.UI.Page

    Public url As String
    Public smc As String
    Public html As String
    Public jScript As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        url = Request.QueryString("url")
        smc = Request.QueryString("smc")

        'If url.Contains("http://") Then
        '    url = url
        'Else
        '    url = "http://" & url
        'End If

        Dim hiddenParam As String = ""
        hiddenParam = "<input type=""hidden"" value=""" & Session("staff_no") & """ name=""staff_code"" />"
        hiddenParam = hiddenParam & "<input type=""hidden"" value=""" & Session("department_number") & """ name=""department_code"" />"
        hiddenParam = hiddenParam & "<input type=""hidden"" value=""" & smc & """ name=""smc"" />"

        jScript = "<script type=""text/javascript"">document.forms[""redirect_form""].submit();</script>"
        html = "<form onsubmit="""" target=""redirectFrame"" action=""" & url & """ method=""post"" id=""redirect_form"">{0}</form>"
        html = String.Format(html, hiddenParam)

        Response.Write(html)
        Response.Write(jScript)

    End Sub
End Class
